package com.bwhx.eruler.dao.casdilly.impl;

import java.util.List;

import javax.swing.text.StyledEditorKit.BoldAction;

import org.springframework.stereotype.Repository;

import com.bwhx.eruler.bean.casdilly.ClothesTypeModelData;
import com.bwhx.eruler.dao.casdilly.IClothesTypeModelDataDAO;
import com.bwhx.eruler.dao.impl.BaseDaoImpl;

@Repository
public class ClothesTypeModelDataDAOImp extends BaseDaoImpl<ClothesTypeModelData> implements IClothesTypeModelDataDAO {

	public ClothesTypeModelDataDAOImp() {
		this.setNs("com.bwhx.eruler.mapper.casdilly.ClothesTypeModelDataMapper.");
	}

	@Override
	public boolean insertClothesTypeModelDatas(List<ClothesTypeModelData> entities) {
		boolean bool = false;
		if (entities != null && entities.size() > 0) {
			bool = this.getSqlSession().insert(getNs() + "insertClothesTypeModelDatas", entities) > 0;
		}
		return bool;
	}

	@Override
	public List<ClothesTypeModelData> queryClothesTypeModelDataByTypeIdModelAndSex(ClothesTypeModelData modelData) {
		return this.getSqlSession().selectList(this.getNs() + "queryClothesTypeModelDataByTypeIdModelAndSex",
				modelData);
	}

	@Override
	public boolean deleteClothesTypeModelDataByTypeId(ClothesTypeModelData modelData) {
		boolean bool = true;
		if (modelData != null) {
			try {
				this.getSqlSession().delete(getNs() + "deleteClothesTypeModelDataByTypeId", modelData);
				bool = true;
			} catch (Exception e) {
				bool = false;
			}
		}
		return bool;
	}

	@Override
	/**
	 * 根据品类名称获取该品类下的所有号型数据
	 * @param typeName 品类名称
	 * @return 号型数据
	 */
	public List<ClothesTypeModelData> queryClothesTypeModelDataByTypeName(String typeName) {
		return this.getSqlSession().selectList(this.getNs() + "queryClothesTypeModelDataByTypeName",
				typeName);
	}
}
